import os


def Ping_IP(IP):
    result = os.popen('ping %s' % IP)

    re = result.read()

    if "无法访问目标主机" in re or "请求超时" in re:
        return 0
    else:
        return 1
